package com.leetcode.June;

import javax.swing.tree.TreeNode;

/**
 * @Description: 反转二叉树
 * @Author: Mr.Fxy
 * @CreateTime: 2024-07-23 22:03
 */
public class InvertTree {
    public TreeNode invertTree(TreeNode root) {
        if (root == null) return null;
        invertTree(root.left);
        invertTree(root.right);
        TreeNode node = root.left;
        root.left=root.right;
        root.right=node;
        return root;
    }
}

